package spring.ribbon;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * 测试使用接口，服务提供者
 */
@RestController
public class Controller {

    @Autowired
    private RestTemplate restTemplate;
    private static final String REST_URL_PREFIX = "http://springcloud-provider";

    @RequestMapping("/test")
    public String test(){
        return restTemplate.getForObject(
                REST_URL_PREFIX+"/car/123",
                String.class);
    }
}
